#include "common.h"
VOID   __System_Call__(U4B function,U4B p1,U4B p2,U4B p3)
{
    switch(function)
    {
        case SYSCALL_SENDMESSAGE:
        { 
          // if((U4B)WhoRunning==0xA00000)Print(" in the send upt%X ",p1);
           p1=(U4B)VAToLA(WhoRunning,(U4B)p1);
//if((U4B)WhoRunning==0xA00000)Print(" in the send  interrupt%X ",((PMESSAGE)p1)->sourcepid);
           (*((S4B*)(VAToLA(WhoRunning,p3))))=Send((PMESSAGE)p1,(U4B)p2);
           break;
        }
        case SYSCALL_RECEIVEMESSAGE:
        { 
           p1=(U4B)VAToLA(WhoRunning,(U4B)p1);
           (*((S4B*)(VAToLA(WhoRunning,p3))))=Receive((PMESSAGE)p1,(U4B)p2);
           break;
        }
        case SYSCALL_WAITSIGNAL:
        {
           p1=(U4B)VAToLA(WhoRunning,(U4B)p1);
           (*((S4B*)(VAToLA(WhoRunning,p3))))=Wait((PSIGNAL)p1,(U4B)p2);
           break;
        }
        case SYSCALL_NOTIFYSIGNAL:
        {
           p1=(U4B)VAToLA(WhoRunning,(U4B)p1);
           (*((S4B*)(VAToLA(WhoRunning,p3))))=Notify((PSIGNAL)p1,(U4B)p2);
           break;
        }
        case SYSCALL_ACTIVATE:   /*this function is not allowed for usr*/
        { 
           (*((S4B*)p3))=Activate((PPROCESS)p1);
           break;
        }
        case SYSCALL_DETACH:
        {
           (*((S4B*)p3))=Detach((U4B)p1);
           break;
        }
        case SYSCALL_GETPCB:
        {
           p1=(U4B)VAToLA(WhoRunning,(U4B)p1);
          (*((S4B*)(VAToLA(WhoRunning,p3))))=GetPCB((PPCBITEM)p1,(U4B)p2);
//          (*((S4B*)(VAToLA(WhoRunning,p3))))=GetPCB((U4B)p1,(PPROCESS)p2);
          break;
        }
             
    } 
}
